//导入request.js请求工具
import request from '@/utils/request.js'

// 分页查询批发商批号


export const getWholBatchPageService = (params) => {
  return request.get('/wholesaler/wholBatch/page', { params })
}

// 发送确认请求
export const sendConfirmService = (id) => {
  return request.put(`/wholesaler/wholBatch/update`, { wbId: id, state: 2 })
}

// 获取当前登录批发商信息
export const getCurrentWholesalerService = () => {
  return request.get('/wholesaler/current')
}

// 删除批发商产品批号
export const deleteWholBatchService = (id) => {
  return request.delete(`/wholesaler/wholBatch/${id}`)
}

// 获取批发商产品批号详情
export const getWholBatchDetailService = (id) => {
  return request.get(`/wholesaler/wholBatch/detail/${id}`)
}

// 更新批发商产品批号
export const updateWholBatchService = (batchData) => {
  return request.put('/wholesaler/wholBatch/update', batchData)
}

// 创建批发商产品批号
export const createWholBatchService = (batchData) => {
  return request.post('/wholesaler/wholBatch/create', batchData)
}

// 获取待确认的零售商进场列表
export const getRetailerConfirmListService = (params) => {
  return request.get('/wholesaler/wholBatch/downstreamConfirm', { params })
}

// 确认零售商进场请求
export const confirmRetailerBatchService = (retaBatchId) => {
  return request.put(`/wholesaler/wholBatch/confirm/${retaBatchId}`)
}

// 获取省份列表
export const getProvincesService = () => {
  return request.get('/wholesaler/wholBatch/provinces')
}

// 根据省份获取城市
export const getCitiesService = (provId) => {
  return request.get('/wholesaler/wholBatch/cities', { params: { provId } })
}

// 获取屠宰企业列表
export const getSlaughterEntsService = (params) => {
  return request.get('/wholesaler/wholBatch/slaughterEnterprises', { params })
}

// 获取屠宰企业批号列表
export const getSlauBatchesService = (slauId) => {
  return request.get('/wholesaler/wholBatch/slaughterBatches', { params: { slauId } })
}

// 下架产品批号
export const offlineWholBatchService = (id) => {
  return request.put(`/wholesaler/wholBatch/offline/${id}`)
}

// 按状态查询批号
export const getWholBatchByStateService = (state) => {
  return request.get('/wholesaler/wholBatch/byState', { params: { state } })
}

// 检查批号是否存在
export const checkWholBatchIdExistsService = (batchId) => {
  return request.get('/wholesaler/wholBatch/checkBatchId', { params: { batchId } })
}